package com.ruoyi.consumer.service;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.consumer.entity.TbUserLogin;
import com.ruoyi.consumer.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public AjaxResult login(TbUserLogin tbUserLogin) {
        String loanUserLoginName = tbUserLogin.getLoanUserLoginName();
        TbUserLogin user=userMapper.findUserName(loanUserLoginName);
        if (user==null){
            return AjaxResult.error("用户名或密码错误");
        }
        if (!user.getLoanUserLoginPwd().equals(tbUserLogin.getLoanUserLoginPwd())){
            return AjaxResult.error("用户名或密码错误");
        }



        return AjaxResult.success("登录成功", user);
    }
}
